/****************************************************************************
 * Copyright (C) 2025 Chenyz. All rights reserved.
 *
 * @file    TinyOS_Semaphore.h
 *
 * @par     dependencies
 *          - stdint.h (Standard integer types)
 *          - TinyOS_Types.h (Type definitions)
 *
 * @author  Chenyz
 *
 * @brief   Semaphore Management Header
 *          This file provides declarations for counting semaphore operations
 *          in TinyOS, including:
 *          - Semaphore initialization and configuration
 *          - Blocking and non-blocking semaphore acquisition
 *          - Semaphore release and task wake-up
 *          - Semaphore information retrieval and cleanup
 *
 * @version V1.0
 * @date    2025-10-03
 *
 * @note    This module implements counting semaphores for task synchronization
 *          and resource management in the system.
 ****************************************************************************/

#ifndef __TINYOS_SEMAPHORE_H__
#define __TINYOS_SEMAPHORE_H__

/******************************** Includes **********************************/
#include <stdint.h>
#include "TinyOS_Types.h"

/*************************** Function Declarations **************************/

/* Semaphore management functions */
void TinyOS_SemaphoreInit(
    TinyOS_SemaphoreType* Semaphore,
    uint32_t StartCount,
    uint32_t MaxCount
);
uint32_t TinyOS_SemaphoreTake(
    TinyOS_SemaphoreType* Semaphore,
    uint32_t WaitTicks
);
uint32_t TinyOS_SemaphoreTakeNoWait(TinyOS_SemaphoreType* Semaphore);
void TinyOS_SemaphoreGive(TinyOS_SemaphoreType* Semaphore);
void TinyOS_SemaphoreGetInfo(
    TinyOS_SemaphoreType* Semaphore,
    TinyOS_SemaphoreInfo* Info
);
uint32_t TinyOS_SemaphoreDeInit(TinyOS_SemaphoreType* Semaphore);


#endif /* __TINYOS_SEMAPHORE_H__ */

